home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Add-Ons
/
After Dark
/
Refractor 1.0
/
Source
/
Refractor.h
< prev
Wrap
Text File
|
1995-11-05
|
2KB
|
73 lines
//////////
//
// Refractor 1.0
// ©1995 Steven J. Bushell
//
//////////
#pragma once
#include <QDOffscreen.h>
#include "GraphicsModule_Types.h"
#if powerc
const long maxBoxSize = 512L;
#else
#if __MC68881__
const long maxBoxSize = 256L;
#else
const long maxBoxSize = 128L;
#endif
#endif
const long maxSlopSize = 16L;
typedef struct RStorage
{
Rect travelRect; // the moving pane
Rect slopRect; // the moving pane plus its update region.
Rect oldSlopRect; // the slopRect from the previous frame.
Fixed travelAngle; // the current angle refraction is traveling.
Fixed travelSin; // the current sin of angle of travel.
Fixed travelCos; // the current cos of angle of travel.
short hDir; // current sign of x-component of velocity
short vDir; // current sign of y-component of velocity
short timeToReselect; // is it time to select a new random style?
short needToUpdate; // do we need to update the offset buffer?
unsigned long lastTouch; // the time of the last size slider touch (for tracking)
short timeToChange; // is it time to change direction
short refractorStyle; // popup choice
GWorldPtr srcWorld; // Image of a portion of the untouched screen.
GWorldPtr dstWorld; // The pixels about to be blitted to the screen.
Handle offsetBuffer; // Contains the array of offsets for each pixel.
RgnHandle drawRgn; // Where are we going to draw?
RgnHandle oldDrawRgn; // Where did we draw?
// Off-screen drawing support.
PixMapHandle worldPixels; // active pixels when drawing offscreen.
CGrafPtr savedCPort; // CPort to restore when done drawing offscreen.
GDHandle savedGDevice; // Device Handle to restore when done drawing offscreen.
} RStorage, *RStoragePtr, **RStorageHandle;
// Core routines.
OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
void CleanUp(RStorage** storage);
OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
OSErr DoDrawFrame(Handle storage,RgnHandle blankRgn,GMParamBlockPtr params);
OSErr DoClose(Handle storage,RgnHandle blankRgn,GMParamBlockPtr params);
OSErr DoSetUp(RgnHandle blankRgn,short message,GMParamBlockPtr params);
// Popup values.
enum
{
eRandom = 1,
eWavyGravy = 3,
eHurricane,
eFisheye,
eWildDiffuser,
eSpectacle,
eMagnifier,
eWormhole,
eRipple
};